package com.tanhua.dubbo.api;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tanhua.dubbo.mappers.SettingsMapper;
import com.tanhua.model.domain.Question;
import com.tanhua.model.domain.Settings;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

@DubboService
public class SettingsApiImpl implements SettingsApi {

    @Autowired
    private SettingsMapper mapper;
    @Override
    public Settings findByUserId(Long id) {
        QueryWrapper<Settings> wrapper=new QueryWrapper<>();
        wrapper.eq("user_id",id);
        return mapper.selectOne(wrapper);
    }

    @Override
    public void save(Settings settings) {
        mapper.insert(settings);
    }

    @Override
    public void update(Settings settings) {
        mapper.updateById(settings);
    }
}